Code Analysis Tool
FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements.
FxCop can be accessed in two ways:
-
Within the Ultimate or Premium version of Microsoft Visual Studio 2010/2012 as Code Analysis
-
As a stand-alone FxCop application
Information about how to use both applications is included below.
If you have access to FxCop, Travelport recommends using it as a best practice to analyze the code.
-
Use the Microsoft Minimum Recommended Rules rule set within FxCop to analyze your code.
-
Review each critical error, error, or critical warning.
Using Microsoft Visual Studio Code Analysis Tool
FxCop has been integrated with the Microsoft Visual Studio 2010 Ultimate and Premium versions. If you have either of these Visual Studio versions, you can use FxCop to analyze your code during development. Within Visual Studio, you can choose to run a code analysis each time your build your solution, or you can run code analysis manually as needed.
Automatic Code Analysis
To run a code analysis each time you build your project,
-
Within Microsoft Visual Studio 2010, select the Project menu, then Properties.
-
Click the Code Analysis tab.
-
To run code analysis each time you build a project, check the Enable Code Analysis on Build option.
-
In the Rule Set drop-down list, select Microsoft Minimum Recommended Rules. For more information, refer to http://msdn.microsoft.com/en-us/library/dd264893.aspx.
With the settings defined above, each time you build your solution, a code analysis is run. Review each critical error, error, or critical warning.
Manual Code Analysis
The rules that are checked when code analysis is run are specified on the Code Analysis page of the project property pages. To run code analysis manually on a project,
-
In Solution Explorer, click the project.
-
On the Analyze menu, click Run Code Analysis on Project Name.
Using the Stand-alone FxCop Application
If you do not have Visual Studio Ultimate or Premium, you can download the stand-alone FxCop application from http://www.microsoft.com.
-
From the Windows Start menu, select Programs, then Microsoft FxCop.
-
From the Project menu, select Add Targets. Select the DLL to analyze.
-
Click the Analyze button. The Active pane displays all errors and warnings.
-
Review each critical error, error, or critical warning.
Resources
For more information about the FxCop application, refer to the following resources:
http://msdn.microsoft.com/en-us/library/bb429476(v=VS.80).aspx
http://msdn.microsoft.com/en-us/library/dd264897.aspx